#ifndef MESHPROCESS_HPP
#define MESHPROCESS_HPP

#include <assert.h>
#include <iostream>
#include <vector>
using namespace std;

/* Generate the IEN, INN array and basic information of
 * the mesh: nElem, nFunc, nLocBas, etc.
 * NOTE: The IEN and INN array need to be set up as 
 * int ** pointer, and they need to be deleted by the 
 * INN_IEN_2d_cleanup routine given in below.             */

void INN_IEN_2d_setup( const vector<double> sKnots,
                       const vector<double> tKnots,
                       const int sDegree,
                       const int tDegree, 
                       int ** &INN,
                       int ** &IEN,
                       double * &hx,
                       double * &hy,
                       int &nElem,
                       int &nElem_x,
                       int &nElem_y,
                       int &nFunc,
                       int &nFunc_x,
                       int &nFunc_y,
                       int &nLocBas
                      );

void INN_IEN_2d_cleanup( int ** &IEN,
                         int ** &INN,
                         int nElem,
                         int nFunc, 
                         double * &hx,
                         double * &hy );

/* This is the function that returns the nqp quadrature points
 * and weights */
void QuadratureRule(int nqp, double * &qp, double * &wq);

void QuadratureClean( double * &qp, double * &wq );
#endif
